package com.wanter.boot01.demo.controller;

import com.wanter.boot01.demo.entity.Demo;
import com.wanter.boot01.demo.service.DemoService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

@RestController
@RequestMapping("/demo/")
public class DemoController {
    @Resource
    private DemoService demoService;

    @GetMapping("test")
    public Map testMap(){
        Map<String,Object> map = new HashMap<>();
        map.put("aaa","bbbb");
        map.put("ccc","dddd");
        System.out.println(map);
        return map;
    }


    @GetMapping("demo-service")
    public List<Demo> testService(){
        List<Demo> list = demoService.findAll();
        return list;
    }

}
